
/*
 * Change Logs:
 * Date           Author       Notes
 * 2022-01-27     tyustli          first implementation
 */

#ifndef __HEAD_LINK_H__
#define __HEAD_LINK_H__
#include "def.h"

typedef int ElemType;

struct LNode
{
    ElemType data;
    struct LNode *next;
};
typedef struct LNode *LinkList; // 另一种定义LinkList的方法

void InitList(LinkList *L);
void DestroyList(LinkList *L);
void ClearList(LinkList L);
Status ListEmpty(LinkList L);
int ListLength(LinkList L);
Status GetElem(LinkList L, int i, ElemType *e);
int LocateElem(LinkList L, ElemType e, Status (*compare)(ElemType, ElemType));
Status PriorElem(LinkList L, ElemType cur_e, ElemType *pre_e);
Status NextElem(LinkList L, ElemType cur_e, ElemType *next_e);
Status ListInsert(LinkList L, int i, ElemType e);
Status ListDelete(LinkList L, int i, ElemType *e);
void ListTraverse(LinkList L, void (*vi)(ElemType));

Status equal(ElemType c1, ElemType c2);
int comp(ElemType a, ElemType b);
void print(ElemType c);
void print2(ElemType c);
void print1(ElemType *c);

#endif /* __HEAD_LINK_H__ */

/****************** end of file ********************/
